<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>webpack4+vue-cli3 | mozihao</title><meta name="keywords" content="webpack4+vue-cli3"><meta name="author" content="mozihao"><meta name="copyright" content="mozihao"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="先使用vue-cli3创建vue项目1.然后外层文件夹创建index.html文件(里面创建一个以app为id的div标签)，创建build文件夹，dist文件夹文件目录：  2.安装依赖 安装 webpack 四件套1npm i webpack webpack-cli webpack-dev-server webpack-merge --save-dev html 解析也属于基本配置     —">
<meta property="og:type" content="article">
<meta property="og:title" content="webpack4+vue-cli3">
<meta property="og:url" content="https://mo_zi_hao.gitee.io/blog/posts/29998/index.html">
<meta property="og:site_name" content="mozihao">
<meta property="og:description" content="先使用vue-cli3创建vue项目1.然后外层文件夹创建index.html文件(里面创建一个以app为id的div标签)，创建build文件夹，dist文件夹文件目录：  2.安装依赖 安装 webpack 四件套1npm i webpack webpack-cli webpack-dev-server webpack-merge --save-dev html 解析也属于基本配置     —">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/745.jpg">
<meta property="article:published_time" content="2021-08-29T15:22:14.598Z">
<meta property="article:modified_time" content="2021-08-29T15:22:14.598Z">
<meta property="article:author" content="mozihao">
<meta property="article:tag" content="webpack4+vue-cli3">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/745.jpg"><link rel="shortcut icon" href="/blog/img/favicon.png"><link rel="canonical" href="https://mo_zi_hao.gitee.io/blog/posts/29998/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/blog/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/blog/',
  algolia: undefined,
  localSearch: {"path":"search.xml","languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"簡"},
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js',
      css: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: true,
  isanchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = { 
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2021-08-29 23:22:14'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    })(window)</script><link rel="stylesheet" type="text/css" href="./css/iconfont.css" media="all"><meta name="generator" content="Hexo 5.4.2"><link rel="alternate" href="/blog/atom.xml" title="mozihao" type="application/atom+xml">
</head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="author-avatar"><img class="avatar-img" src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/%E6%B5%B7%E8%B4%BC008.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/blog/archives/"><div class="headline">文章</div><div class="length-num">24</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/blog/tags/"><div class="headline">标签</div><div class="length-num">16</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/blog/categories/"><div class="headline">分类</div><div class="length-num">11</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/blog/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/blog/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/blog/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/blog/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/blog/about/"><i class="fa-fw fas fa-heart"></i><span> 前端知识思维导图</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://gitee.com/mo_zi_hao/picsBed/raw/master/image/745.jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/blog/">mozihao</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/blog/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/blog/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/blog/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/blog/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/blog/about/"><i class="fa-fw fas fa-heart"></i><span> 前端知识思维导图</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">webpack4+vue-cli3</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2021-08-29T15:22:14.598Z" title="发表于 2021-08-29 23:22:14">2021-08-29</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2021-08-29T15:22:14.598Z" title="更新于 2021-08-29 23:22:14">2021-08-29</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/blog/categories/webpack/">webpack</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">1.2k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>5分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="webpack4+vue-cli3"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h4 id="先使用vue-cli3创建vue项目"><a href="#先使用vue-cli3创建vue项目" class="headerlink" title="先使用vue-cli3创建vue项目"></a>先使用vue-cli3创建vue项目</h4><h4 id="1-然后外层文件夹创建index-html文件-里面创建一个以app为id的div标签-，创建build文件夹，dist文件夹"><a href="#1-然后外层文件夹创建index-html文件-里面创建一个以app为id的div标签-，创建build文件夹，dist文件夹" class="headerlink" title="1.然后外层文件夹创建index.html文件(里面创建一个以app为id的div标签)，创建build文件夹，dist文件夹"></a>1.然后外层文件夹创建index.html文件(里面创建一个以app为id的div标签)，创建build文件夹，dist文件夹</h4><p>文件目录：</p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/clipboard0.png" alt="文件目录"></p>
<h4 id="2-安装依赖"><a href="#2-安装依赖" class="headerlink" title="2.安装依赖"></a>2.安装依赖</h4><ol>
<li><h5 id="安装-webpack-四件套"><a href="#安装-webpack-四件套" class="headerlink" title="安装 webpack 四件套"></a>安装 webpack 四件套</h5><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm i webpack webpack-cli webpack-dev-server webpack-merge --save-dev</span><br></pre></td></tr></table></figure></li>
<li><h5 id="html-解析也属于基本配置-—-webpack-base-js"><a href="#html-解析也属于基本配置-—-webpack-base-js" class="headerlink" title="html 解析也属于基本配置     —-webpack.base.js"></a>html 解析也属于基本配置     —-webpack.base.js</h5><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm i html-webpack-plugin --save-dev</span><br></pre></td></tr></table></figure></li>
<li><h5 id="引入vue-loader"><a href="#引入vue-loader" class="headerlink" title="引入vue-loader"></a>引入vue-loader</h5></li>
<li><h5 id="安装css-loader-预处理器-后处理器"><a href="#安装css-loader-预处理器-后处理器" class="headerlink" title="安装css loader 预处理器    后处理器"></a>安装css loader 预处理器    后处理器</h5><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">npm i css-loader style-loader --save-dev   <span class="comment">//css基础loader</span></span><br><span class="line">npm i less less-loader --save-dev      <span class="comment">//css预处理</span></span><br><span class="line">npm i node-sass sass-loader --save-dev      <span class="comment">//css预处理 这里sass如果用npm安装失败就使用cnpm安装</span></span><br><span class="line">npm i postcss-loader autoprefixer --save-dev   <span class="comment">//css后处理</span></span><br></pre></td></tr></table></figure></li>
<li><h5 id="安装解析图片，字体等都是用-file-loader"><a href="#安装解析图片，字体等都是用-file-loader" class="headerlink" title="安装解析图片，字体等都是用 file-loader"></a>安装解析图片，字体等都是用 file-loader</h5><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm i file-loader --save-dev</span><br></pre></td></tr></table></figure></li>
<li><h5 id="优化"><a href="#优化" class="headerlink" title="优化"></a>优化</h5></li>
</ol>
<ul>
<li>解决每次重新打包，dist文件夹文件未清除</li>
</ul>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install --save-dev clean-webpack-plugin </span><br></pre></td></tr></table></figure>

<ul>
<li>分离 CSS</li>
</ul>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install --save-dev mini-css-extract-plugin</span><br></pre></td></tr></table></figure>

<ul>
<li>图片压缩</li>
</ul>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install --save-dev image-webpack-loader</span><br></pre></td></tr></table></figure>

<ul>
<li>CSS压缩</li>
</ul>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install --save-dev optimize-css-assets-webpack-plugin</span><br></pre></td></tr></table></figure>

<h4 id="3-创建-postcss-config-js-文件"><a href="#3-创建-postcss-config-js-文件" class="headerlink" title="3.创建 postcss.config.js 文件"></a>3.创建 postcss.config.js 文件</h4><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// postcss.config.js</span></span><br><span class="line"><span class="comment">// 自动添加css兼容属性</span></span><br><span class="line"><span class="comment">// 需要配置这个插件信息</span></span><br><span class="line"><span class="built_in">module</span>.exports = &#123;</span><br><span class="line">    plugins: [</span><br><span class="line">        <span class="built_in">require</span>(<span class="string">&#x27;autoprefixer&#x27;</span>)(&#123;</span><br><span class="line">            overrideBrowserslist: [</span><br><span class="line">                <span class="string">&quot;Android 4.1&quot;</span>,</span><br><span class="line">                <span class="string">&quot;iOS 7.1&quot;</span>,</span><br><span class="line">                <span class="string">&quot;Chrome &gt; 31&quot;</span>,</span><br><span class="line">                <span class="string">&quot;ff &gt; 31&quot;</span>,</span><br><span class="line">                <span class="string">&quot;ie &gt;= 8&quot;</span></span><br><span class="line">            ]</span><br><span class="line">        &#125;)</span><br><span class="line">    ]</span><br><span class="line">&#125;;</span><br></pre></td></tr></table></figure>

<h4 id="4-webpack-base-js"><a href="#4-webpack-base-js" class="headerlink" title="4.webpack.base.js"></a>4.webpack.base.js</h4><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// webpack.base.js </span></span><br><span class="line"><span class="comment">// 存放 dev 和 prod 通用配置 </span></span><br><span class="line"><span class="keyword">const</span> webpack = <span class="built_in">require</span>(<span class="string">&#x27;webpack&#x27;</span>); </span><br><span class="line"><span class="keyword">const</span> resolve = <span class="function"><span class="params">dir</span> =&gt;</span> path.join(__dirname, <span class="string">&#x27;..&#x27;</span>,dir);    <span class="comment">//定义配置别名方法</span></span><br><span class="line"><span class="keyword">const</span> VueLoaderPlugin = <span class="built_in">require</span>(<span class="string">&#x27;vue-loader/lib/plugin&#x27;</span>);  <span class="comment">//***** 2.3 ***** vue-loader 插件  这里vue-cli中已经安装vue-loader vue-template-compiler，如果没有，运行命令安装： npm i vue-loader vue-template-compiler --save-dev</span></span><br><span class="line"><span class="keyword">const</span> HtmlWebpackPlugin = <span class="built_in">require</span>(<span class="string">&#x27;html-webpack-plugin&#x27;</span>); <span class="comment">//***** 2.2 ******  html 解析也属于基本配置</span></span><br><span class="line"><span class="keyword">const</span> path = <span class="built_in">require</span>(<span class="string">&quot;path&quot;</span>); </span><br><span class="line"><span class="built_in">module</span>.exports = &#123; </span><br><span class="line">    entry: <span class="string">&#x27;./src/main.js&#x27;</span>, <span class="comment">//入口,</span></span><br><span class="line">    resolve: &#123;</span><br><span class="line">        <span class="comment">// 设置别名</span></span><br><span class="line">        alias: &#123;</span><br><span class="line">            <span class="string">&#x27;@&#x27;</span>: resolve(<span class="string">&#x27;src&#x27;</span>)<span class="comment">// 这样配置后 @ 可以指向 src 目录</span></span><br><span class="line">        &#125;</span><br><span class="line">    &#125;, </span><br><span class="line">    <span class="built_in">module</span>: &#123; </span><br><span class="line">        rules: [</span><br><span class="line">          &#123;    <span class="comment">//配置vue文件    ***** 2.3 ****</span></span><br><span class="line">             test: <span class="regexp">/\.vue$/</span>,</span><br><span class="line">             loader: <span class="string">&#x27;vue-loader&#x27;</span></span><br><span class="line">          &#125;,</span><br><span class="line">          &#123;   <span class="comment">//配置 css预处理sass   **** 2.4 *****</span></span><br><span class="line">            test: <span class="regexp">/\.(sa|sc|c)ss$/</span>,</span><br><span class="line">            use: [</span><br><span class="line">              <span class="string">&#x27;style-loader&#x27;</span>,</span><br><span class="line">              <span class="string">&#x27;css-loader&#x27;</span>,</span><br><span class="line">              <span class="comment">//&#x27;postcss-loader&#x27;,</span></span><br><span class="line">              <span class="string">&#x27;sass-loader&#x27;</span>,</span><br><span class="line">            ],</span><br><span class="line">          &#125;,</span><br><span class="line">          &#123;  <span class="comment">//配置 css预处理less   ****** 2.4 ******</span></span><br><span class="line">            test: <span class="regexp">/\.less$/</span>,</span><br><span class="line">            use: [</span><br><span class="line">              <span class="string">&#x27;style-loader&#x27;</span>,</span><br><span class="line">              <span class="string">&#x27;css-loader&#x27;</span>,</span><br><span class="line">             <span class="comment">// &#x27;postcss-loader&#x27;,</span></span><br><span class="line">              <span class="string">&#x27;less-loader&#x27;</span>,</span><br><span class="line">            ],</span><br><span class="line">          &#125;,</span><br><span class="line">          &#123;  <span class="comment">//图片配置及输出处理  ****** 2.5 ******   vue里面img应用静态图片需要引入不能直接赋予绝对路径 import imgUrl from &#x27;../assets/logo.png&#x27;   通过 :src 绑定引入的变量imgUrl</span></span><br><span class="line">            test: <span class="regexp">/\.(png|jpe?g|gif)$/i</span>,</span><br><span class="line">            loader: <span class="string">&#x27;file-loader&#x27;</span>,</span><br><span class="line">            options: &#123;</span><br><span class="line">               limit: <span class="number">5000</span>,</span><br><span class="line">               name: <span class="string">&#x27;[path][name].[ext]&#x27;</span>,  <span class="comment">//这里将图片都打包到img文件夹</span></span><br><span class="line">               publicPath: <span class="string">&#x27;/&#x27;</span>,    </span><br><span class="line">            &#125;,</span><br><span class="line">          &#125;,</span><br><span class="line">        ] </span><br><span class="line">    &#125;, </span><br><span class="line">    plugins: [ <span class="comment">// 插件</span></span><br><span class="line">    <span class="comment">// 解决vender后面的hash每次都改变 </span></span><br><span class="line">     <span class="keyword">new</span> webpack.HashedModuleIdsPlugin(),</span><br><span class="line">    </span><br><span class="line">    <span class="comment">//html 解析也属于基本配置***** 2.2 ******</span></span><br><span class="line">     <span class="keyword">new</span> HtmlWebpackPlugin(&#123;</span><br><span class="line">      template: path.resolve(__dirname, <span class="string">&#x27;../index.html&#x27;</span>),</span><br><span class="line">    &#125;),</span><br><span class="line">    </span><br><span class="line">    <span class="comment">//***** 3 ***** vue-loader</span></span><br><span class="line">    <span class="keyword">new</span> VueLoaderPlugin(),</span><br><span class="line">   ], </span><br><span class="line">&#125;;</span><br></pre></td></tr></table></figure>

<h4 id="5-webpack-dev-js"><a href="#5-webpack-dev-js" class="headerlink" title="5.webpack.dev.js"></a>5.webpack.dev.js</h4><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// webpack.dev.js</span></span><br><span class="line"><span class="comment">// 存放 dev 配置</span></span><br><span class="line"><span class="keyword">const</span> &#123;merge&#125; = <span class="built_in">require</span>(<span class="string">&#x27;webpack-merge&#x27;</span>);</span><br><span class="line"><span class="keyword">const</span> common = <span class="built_in">require</span>(<span class="string">&#x27;./webpack.base.js&#x27;</span>);</span><br><span class="line"><span class="keyword">const</span> path = <span class="built_in">require</span>(<span class="string">&#x27;path&#x27;</span>);</span><br><span class="line"></span><br><span class="line"><span class="built_in">module</span>.exports = merge(common, &#123;</span><br><span class="line">  devtool: <span class="string">&#x27;inline-source-map&#x27;</span>,</span><br><span class="line">  devServer: &#123; <span class="comment">// 开发服务器</span></span><br><span class="line">    contentBase: <span class="string">&#x27;../dist&#x27;</span></span><br><span class="line">  &#125;,</span><br><span class="line">  output: &#123; <span class="comment">// 输出</span></span><br><span class="line">    filename: <span class="string">&#x27;js/[name].[hash].js&#x27;</span>, <span class="comment">// 每次保存 hash 都变化</span></span><br><span class="line">    path: path.resolve(__dirname, <span class="string">&#x27;../dist&#x27;</span>)</span><br><span class="line">  &#125;,</span><br><span class="line">  <span class="built_in">module</span>: &#123;&#125;,</span><br><span class="line">  mode: <span class="string">&#x27;development&#x27;</span>,</span><br><span class="line">&#125;);</span><br></pre></td></tr></table></figure>

<h4 id="6-webpack-prod-js"><a href="#6-webpack-prod-js" class="headerlink" title="6.webpack.prod.js"></a>6.webpack.prod.js</h4><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// webpack.prod.js</span></span><br><span class="line"><span class="comment">// 存放 prod 配置</span></span><br><span class="line"><span class="keyword">const</span> path = <span class="built_in">require</span>(<span class="string">&#x27;path&#x27;</span>);</span><br><span class="line"><span class="comment">// 合并配置文件</span></span><br><span class="line"><span class="keyword">const</span> &#123;merge&#125; = <span class="built_in">require</span>(<span class="string">&#x27;webpack-merge&#x27;</span>);</span><br><span class="line"><span class="keyword">const</span> common = <span class="built_in">require</span>(<span class="string">&#x27;./webpack.base.js&#x27;</span>);</span><br><span class="line"><span class="keyword">const</span> &#123;CleanWebpackPlugin&#125; = <span class="built_in">require</span>(<span class="string">&#x27;clean-webpack-plugin&#x27;</span>)    <span class="comment">//***** 2.6.1 **** </span></span><br><span class="line"><span class="keyword">const</span> MiniCssExtractPlugin = <span class="built_in">require</span>(<span class="string">&#x27;mini-css-extract-plugin&#x27;</span>);    <span class="comment">// ***** 2.6.2 ******</span></span><br><span class="line"><span class="keyword">const</span> OptimizeCSSAssetsPlugin = <span class="built_in">require</span>(<span class="string">&#x27;optimize-css-assets-webpack-plugin&#x27;</span>)   <span class="comment">//***** 2.6.4 *****</span></span><br><span class="line"></span><br><span class="line"><span class="built_in">module</span>.exports = merge(common, &#123;</span><br><span class="line">  <span class="built_in">module</span>: &#123;</span><br><span class="line">       rules: [</span><br><span class="line">            &#123;</span><br><span class="line">                test: <span class="regexp">/\.vue$/</span>,</span><br><span class="line">                loader: <span class="string">&quot;vue-loader&quot;</span>,</span><br><span class="line">            &#125;,</span><br><span class="line">            </span><br><span class="line">            <span class="comment">// css loader中的style-loader 替换为 MiniCssExtractPlugin</span></span><br><span class="line">            &#123;</span><br><span class="line">                test: <span class="regexp">/\.(sa|sc|c)ss$/</span>,</span><br><span class="line">                use: [</span><br><span class="line">                    MiniCssExtractPlugin.loader,    <span class="comment">// ****** 2.6.2 *****</span></span><br><span class="line">                    <span class="string">&quot;css-loader&quot;</span>,</span><br><span class="line">                    <span class="comment">// &quot;postcss-loader&quot;,</span></span><br><span class="line">                    <span class="string">&quot;sass-loader&quot;</span>,</span><br><span class="line">                ],</span><br><span class="line">            &#125;,</span><br><span class="line">            &#123;</span><br><span class="line">                test: <span class="regexp">/\.less$/</span>,</span><br><span class="line">                use: [</span><br><span class="line">                    MiniCssExtractPlugin.loader,    <span class="comment">// ****** 2.6.2 *****</span></span><br><span class="line">                    <span class="string">&quot;css-loader&quot;</span>,</span><br><span class="line">                    <span class="comment">// &quot;postcss-loader&quot;,</span></span><br><span class="line">                    <span class="string">&quot;less-loader&quot;</span>,</span><br><span class="line">                ],</span><br><span class="line">            &#125;,</span><br><span class="line"></span><br><span class="line">            &#123;</span><br><span class="line">                test: <span class="regexp">/\.(png|jpe?g|gif)$/i</span>,</span><br><span class="line">                use: [</span><br><span class="line">                    &#123;</span><br><span class="line">                        loader: <span class="string">&quot;file-loader&quot;</span>,</span><br><span class="line">                        options: &#123;</span><br><span class="line">                            limit: <span class="number">5000</span>,</span><br><span class="line">                            name: <span class="string">&quot;[path][name].[ext]&quot;</span>,</span><br><span class="line">                            publicPath: <span class="string">&quot;/&quot;</span>,</span><br><span class="line">                        &#125;,</span><br><span class="line">                    &#125;,</span><br><span class="line">                    <span class="comment">//图片压缩   ***** 2.6.3 *****</span></span><br><span class="line">                    &#123;</span><br><span class="line">                      loader: <span class="string">&#x27;image-webpack-loader&#x27;</span>,</span><br><span class="line">                      options: &#123;</span><br><span class="line">                        mozJpeg:&#123;</span><br><span class="line">                          progressive: <span class="literal">true</span>,</span><br><span class="line">                          quality: <span class="number">65</span></span><br><span class="line">                        &#125;,</span><br><span class="line">                        optipng:&#123;</span><br><span class="line">                          enabled: <span class="literal">false</span></span><br><span class="line">                        &#125;,</span><br><span class="line">                        pngquant:&#123;</span><br><span class="line">                          quality: <span class="string">&#x27;65-90&#x27;</span>,</span><br><span class="line">                          speed: <span class="number">4</span></span><br><span class="line">                        &#125;,</span><br><span class="line">                        gifsicle: &#123;</span><br><span class="line">                          interlaced: <span class="literal">false</span></span><br><span class="line">                        &#125;</span><br><span class="line">                      &#125;</span><br><span class="line">                    &#125;</span><br><span class="line">                ],</span><br><span class="line">            &#125;,</span><br><span class="line">        ],</span><br><span class="line">  &#125;,</span><br><span class="line">  plugins: [</span><br><span class="line">    <span class="comment">// 解决每次重新打包，dist文件夹文件未清除  ***** 2.6.1 **** </span></span><br><span class="line">    <span class="keyword">new</span> CleanWebpackPlugin()</span><br><span class="line">    <span class="comment">//分离 CSS   ****** 2.6.2 *****</span></span><br><span class="line">    <span class="keyword">new</span> MiniCssExtractPlugin(&#123;   </span><br><span class="line">      filename: <span class="string">&#x27;css/[name].[hash].css&#x27;</span>,</span><br><span class="line">      chunkFilename: <span class="string">&#x27;css/[id].[hash].css&#x27;</span></span><br><span class="line">    &#125;),</span><br><span class="line">    <span class="comment">//CSS压缩 ***** 2.6.4 *****</span></span><br><span class="line">    <span class="keyword">new</span> OptimizeCSSAssetsPlugin()</span><br><span class="line">  ],</span><br><span class="line">  mode: <span class="string">&#x27;production&#x27;</span>,</span><br><span class="line">  output: &#123;</span><br><span class="line">    filename: <span class="string">&#x27;js/[name].[contenthash].js&#x27;</span>, <span class="comment">//contenthash 若文件内容无变化，则contenthash 名称不变</span></span><br><span class="line">    path: path.resolve(__dirname, <span class="string">&#x27;../dist&#x27;</span>)</span><br><span class="line">  &#125;,</span><br><span class="line">&#125;);</span><br></pre></td></tr></table></figure>

<h4 id="7-创建-npm-命令"><a href="#7-创建-npm-命令" class="headerlink" title="7.创建 npm 命令"></a>7.创建 npm 命令</h4><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="string">&quot;scripts&quot;</span>: &#123;</span><br><span class="line">  <span class="string">&quot;dev&quot;</span>: <span class="string">&quot;webpack-dev-server --hot --open --config build/webpack.dev.js&quot;</span>,</span><br><span class="line">  <span class="string">&quot;build&quot;</span>: <span class="string">&quot;webpack --config build/webpack.prod.js&quot;</span></span><br><span class="line">&#125;,</span><br></pre></td></tr></table></figure>

<p>其中dev中的–hot为热更新</p>
<p>启动项目： npm run dev</p>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:undefined">mozihao</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://mo_zi_hao.gitee.io/blog/posts/29998/">https://mo_zi_hao.gitee.io/blog/posts/29998/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://mo_zi_hao.gitee.io/blog" target="_blank">mozihao</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/blog/tags/webpack4-vue-cli3/">webpack4+vue-cli3</a></div><div class="post_share"><div class="social-share" data-image="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/745.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/blog/posts/15318/"><img class="prev-cover" src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/745.jpg" onerror="onerror=null;src='/blog/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">webpack</div></div></a></div><div class="next-post pull-right"><a href="/blog/posts/40469/"><img class="next-cover" src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/%E6%B5%B7%E8%B4%BCwang5.jpg" onerror="onerror=null;src='/blog/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">从零到白嫖之博客搭建</div></div></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="card-info-avatar is-center"><img class="avatar-img" src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/%E6%B5%B7%E8%B4%BC008.jpg" onerror="this.onerror=null;this.src='/blog/img/friend_404.gif'" alt="avatar"/><div class="author-info__name">mozihao</div><div class="author-info__description">if you risk nothing,then you risk anthing</div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/blog/archives/"><div class="headline">文章</div><div class="length-num">24</div></a></div><div class="card-info-data-item is-center"><a href="/blog/tags/"><div class="headline">标签</div><div class="length-num">16</div></a></div><div class="card-info-data-item is-center"><a href="/blog/categories/"><div class="headline">分类</div><div class="length-num">11</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener" href="https://gitee.com/mo_zi_hao"><i class="iconfont icon-gitee-fill-round"></i><span>我的Gitee</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://gitee.com/mo_zi_hao" target="_blank" title="Gitee"><i class="fab iconfont icon-gitee-fill-round"></i></a><a class="social-icon" href="https://github.com/mmCrazy" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="https://blog.csdn.net/xiaomohhh?spm=1001.2101.3001.5343" target="_blank" title="CSDN"><i class="fab iconfont icon-csdn"></i></a><a class="social-icon" href="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/qrcode_for_gh_d35478eda980_430.jpg" target="_blank" title="公众号"><i class="fab iconfont icon-weixingongzhonghao"></i></a><a class="social-icon" href="mailto:747304031@qq.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>公告</span></div><div class="announcement_content">如文章中有哪些错漏，欢迎各位前端的大佬与我交流并指正，谢谢!!</br>邮箱：747304031@qq.com</br>公众号：一起写前端bug</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%85%88%E4%BD%BF%E7%94%A8vue-cli3%E5%88%9B%E5%BB%BAvue%E9%A1%B9%E7%9B%AE"><span class="toc-number">1.</span> <span class="toc-text">先使用vue-cli3创建vue项目</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#1-%E7%84%B6%E5%90%8E%E5%A4%96%E5%B1%82%E6%96%87%E4%BB%B6%E5%A4%B9%E5%88%9B%E5%BB%BAindex-html%E6%96%87%E4%BB%B6-%E9%87%8C%E9%9D%A2%E5%88%9B%E5%BB%BA%E4%B8%80%E4%B8%AA%E4%BB%A5app%E4%B8%BAid%E7%9A%84div%E6%A0%87%E7%AD%BE-%EF%BC%8C%E5%88%9B%E5%BB%BAbuild%E6%96%87%E4%BB%B6%E5%A4%B9%EF%BC%8Cdist%E6%96%87%E4%BB%B6%E5%A4%B9"><span class="toc-number">2.</span> <span class="toc-text">1.然后外层文件夹创建index.html文件(里面创建一个以app为id的div标签)，创建build文件夹，dist文件夹</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2-%E5%AE%89%E8%A3%85%E4%BE%9D%E8%B5%96"><span class="toc-number">3.</span> <span class="toc-text">2.安装依赖</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#%E5%AE%89%E8%A3%85-webpack-%E5%9B%9B%E4%BB%B6%E5%A5%97"><span class="toc-number">3.1.</span> <span class="toc-text">安装 webpack 四件套</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#html-%E8%A7%A3%E6%9E%90%E4%B9%9F%E5%B1%9E%E4%BA%8E%E5%9F%BA%E6%9C%AC%E9%85%8D%E7%BD%AE-%E2%80%94-webpack-base-js"><span class="toc-number">3.2.</span> <span class="toc-text">html 解析也属于基本配置     —-webpack.base.js</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#%E5%BC%95%E5%85%A5vue-loader"><span class="toc-number">3.3.</span> <span class="toc-text">引入vue-loader</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#%E5%AE%89%E8%A3%85css-loader-%E9%A2%84%E5%A4%84%E7%90%86%E5%99%A8-%E5%90%8E%E5%A4%84%E7%90%86%E5%99%A8"><span class="toc-number">3.4.</span> <span class="toc-text">安装css loader 预处理器    后处理器</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#%E5%AE%89%E8%A3%85%E8%A7%A3%E6%9E%90%E5%9B%BE%E7%89%87%EF%BC%8C%E5%AD%97%E4%BD%93%E7%AD%89%E9%83%BD%E6%98%AF%E7%94%A8-file-loader"><span class="toc-number">3.5.</span> <span class="toc-text">安装解析图片，字体等都是用 file-loader</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#%E4%BC%98%E5%8C%96"><span class="toc-number">3.6.</span> <span class="toc-text">优化</span></a></li></ol></li><li class="toc-item toc-level-4"><a class="toc-link" href="#3-%E5%88%9B%E5%BB%BA-postcss-config-js-%E6%96%87%E4%BB%B6"><span class="toc-number">4.</span> <span class="toc-text">3.创建 postcss.config.js 文件</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#4-webpack-base-js"><span class="toc-number">5.</span> <span class="toc-text">4.webpack.base.js</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#5-webpack-dev-js"><span class="toc-number">6.</span> <span class="toc-text">5.webpack.dev.js</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#6-webpack-prod-js"><span class="toc-number">7.</span> <span class="toc-text">6.webpack.prod.js</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#7-%E5%88%9B%E5%BB%BA-npm-%E5%91%BD%E4%BB%A4"><span class="toc-number">8.</span> <span class="toc-text">7.创建 npm 命令</span></a></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/blog/posts/1/" title="无题"><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/%E6%B5%B7%E8%B4%BC4.jpg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="无题"/></a><div class="content"><a class="title" href="/blog/posts/1/" title="无题">无题</a><time datetime="2022-06-05T05:20:17.974Z" title="发表于 2022-06-05 13:20:17">2022-06-05</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/posts/36549/" title="编写可维护的JavaScript (代码习惯)"><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/%E6%B5%B7%E8%B4%BC4.jpg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="编写可维护的JavaScript (代码习惯)"/></a><div class="content"><a class="title" href="/blog/posts/36549/" title="编写可维护的JavaScript (代码习惯)">编写可维护的JavaScript (代码习惯)</a><time datetime="2022-03-19T03:12:42.624Z" title="发表于 2022-03-19 11:12:42">2022-03-19</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/posts/23125/" title="gitlab-cicd"><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/745.jpg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="gitlab-cicd"/></a><div class="content"><a class="title" href="/blog/posts/23125/" title="gitlab-cicd">gitlab-cicd</a><time datetime="2021-12-20T14:00:59.661Z" title="发表于 2021-12-20 22:00:59">2021-12-20</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/posts/449/" title="前端js基础"><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/26&amp;gp=0.jpg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="前端js基础"/></a><div class="content"><a class="title" href="/blog/posts/449/" title="前端js基础">前端js基础</a><time datetime="2021-08-29T15:22:14.600Z" title="发表于 2021-08-29 23:22:14">2021-08-29</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/posts/35506/" title="微信小程序"><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/1234.jpg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="微信小程序"/></a><div class="content"><a class="title" href="/blog/posts/35506/" title="微信小程序">微信小程序</a><time datetime="2021-08-29T15:22:14.600Z" title="发表于 2021-08-29 23:22:14">2021-08-29</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2023 By mozihao</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="translateLink" type="button" title="简繁转换">繁</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><div class="search-dialog__title" id="local-search-title">本地搜索</div><div id="local-input-panel"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div></div><hr/><div id="local-search-results"></div><span class="search-close-button"><i class="fas fa-times"></i></span></div><div id="search-mask"></div></div><div><script src="/blog/js/utils.js"></script><script src="/blog/js/main.js"></script><script src="/blog/js/tw_cn.js"></script><script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js"></script><script src="/blog/js/search/local-search.js"></script><div class="js-pjax"></div><script id="click-heart" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/click-heart.min.js" async="async" mobile="false"></script><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script><script src="https://cdn.jsdelivr.net/gh/metowolf/MetingJS@1.2/dist/Meting.min.js"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>